var express = require('express');
var router = express.Router();

// 导入用户路由处理函数模块
const handler = require('../router_handler/user')

// 1. 导入验证表单数据的中间件
const expressJoi = require('@escook/express-joi')
// 2. 导入需要的验证规则对象
const { register_schema } = require('../schema/user')

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.render('pages/register');
});

router.post('/', expressJoi(register_schema), handler.register)


module.exports = router;
